package com.hzjq.encrypt

import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity

abstract class AbsActivity : AppCompatActivity() {


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(getContentViewId())
        findViewById<Button>(R.id.backBtn).setOnClickListener { finish() }
        findViewById<TextView>(R.id.titleText).text = getShowTitle()
        onCreated()
    }


    abstract fun onCreated()

    abstract fun getContentViewId():Int

    abstract fun getShowTitle():String

    open fun setShowTitle(title:String){
        findViewById<TextView>(R.id.titleText).text = title
    }

    open fun setOnMoreClick(l: View.OnClickListener){
        findViewById<Button>(R.id.moreBtn).setOnClickListener(l)
    }

    fun hideMore(){
        findViewById<Button>(R.id.moreBtn).visibility = View.GONE
    }
}

